<div>
  <label>姓名:
    <input #heroName />
  </label>
  <button (click)="add(heroName.value); heroName.value='';">
    添加
  </button>
</div>

<ul class="heroes">
  <li *ngFor="let hero of heroes" [ngClass]="{selected: hero===selectedHero}">
    <a routerLink="/detail/{{hero.id}}">
      <span class="badge">{{hero.id}}</span>{{hero.name}}
    </a>
    <button class="delete" title="删除" (click)="delete(hero)">x</button>
  </li>
</ul>



<!-- <app-hero-detail [hero]="selectedHero"></app-hero-detail> -->
